    <div class="toppage">
    	<span class="left_search">
    		<input type="text" onclick="this.value='';" style="width: 165px; padding: 3px;" value="keyword" name="keyword" id="keyword">            
            <select style="width: 130px;" id="company">            
            	<option value="">--Chọn hãng SX--</option>
            	<?php if(isset($company) && $company != null) {?>
            		<?php foreach($company as $k => $v) {?>
        			<option value="<?php echo $v->id;?>"><?php echo $v->name;?></option>
        			<?php }?>                 
        		<?php }?>    
            </select>
            <input onclick="filter()" type="button" class="btn" value="Tìm kiếm" name="submit">
    	</span>
    	
    	<span class="left">
        	<select style="width: 130px;" id="action">
            	<option value="1">Chọn hành động</option>
                <option value="delete">Xóa</option>
                <option value="active">Kích hoạt</option>
                <option value="pending">Hủy kích hoạt</option>                
            </select>
            <input onclick="$('[name=action]').val($('#action').val()); $('#action_form').submit()" value="Apply" class="btn" type="button">
        	<font class="number">(<?php echo $this->products_model->count_by('status', 'yes'); ?>)</font> 
        	<a href="<?php echo current_url(); ?>/?status=active"><font color="#0b9901">Kích hoạt</font></a>
        	<font class="line">|</font>
        	
        	<font class="number">(<?php echo $this->products_model->count_by('status', 'no'); ?>)</font> 
        	<a href="<?php echo current_url(); ?>/?status=pending"><font color="#c60001">Hủy kích hoạt</font></a>
        </span>
        <span class="btnadd">
        	<a onclick="open_form('<?php echo action_link('add'); ?>')" href="javascript:void(0)">Thêm mới sản phẩm</a>
        </span>
    </div>
    <div class="tableout">
    
    	<form method="post" action="<?php echo action_link('do_action'); ?>" id="action_form">

		<div class="title1">
        	<div class="column" style="width: 2%;"><input class="check_all" onclick="check_all(this)" type="checkbox"></div>
            
            <div class="column" style="width: 8%;">ID</div>
            <div class="column" style="width: 30%;">Tên sản phẩm</div>            
            <div class="column" style="width: 10%;">Hãng</div>
            <div class="column" style="width: 10%;">Loại</div>
            <div class="column" style="width: 10%;">Ngày tạo</div>
            <div class="column" style="width: 10%;">SP nổi bật</div>
            <div class="column" style="width: 10%;">SP bán chạy</div>
            <div class="column" style="width: 8%;">Trạng thái</div>
        </div>
        
        <?php if(count($products) > 0): ?>
        <?php $limit = $this->config->item('products', 'limit'); ?>
        <?php foreach($products as $i => $pro): ?>
        <div class="linecate2" id="linecate2">
        	<div class="column" style="width: 2%;"><input name="id[]" value="<?php echo $pro->id; ?>" type="checkbox" /></div>
            

            <div class="column" style="width: 8%;">
            	<a href="javascript:;" class="art"><?php echo $pro->id; ?></a><br>
            </div>
            
            <div id="row_<?php echo $pro->id;?>">
            
            <div class="column" style="width: 30%;" onmouseover="Hovercat('<?php echo $pro->id; ?>')" onmouseout="Outcat('<?php echo $pro->id; ?>')">
            	<a href="javascript:;" class="art"><?php echo $pro->name; ?></a>
                <div class="action" id="neocat-<?php echo $pro->id; ?>">
                    <img src="<?php echo img_link('edit.gif', 'admin'); ?>"><a href="javascript:void(0)" onclick="open_form('<?php echo action_link('edit/'.$pro->id); ?>')">Sửa</a><img src="<?php echo img_link('delete.gif', 'admin'); ?>"><a href="javascript:void(0)" onclick="product_delete('<?php echo $pro->id; ?>')"><font color="#be0000">Xóa</font></a>
                </div>
            </div>
           
            <div class="column" style="width: 10%;"><a href="<?php echo current_url(); ?>/?company_id=<?php echo $pro->id_company;?>"><?php echo $this->products_model->get_company_by_id($pro->id_company); ?></a></div>
            <div class="column" style="width: 10%;"><a href="<?php echo current_url(); ?>/?protype_id=<?php echo $pro->id_product_type;?>"><?php echo $this->products_model->get_product_type_by_id($pro->id_product_type); ?></a></div>
            <div class="column" style="width: 10%;"><font class="date"><?php echo date('d-m-Y', strtotime($pro->date_create)); ?></font></div>
            
            <div class="column" style="width: 10%;">
	            <?php if($pro->hot == 'no'): ?>
				<a href="javascript:void(0);" onclick="product_hot('<?php echo $pro->id;?>', 'yes')"><img src="<?php echo img_link('pending.png', 'admin'); ?>" class="icon png" title="Sản phẩm nổi bật" alt="Sản phẩm nổi bật"></a>
	            <?php else: ?>
				<a href="javascript:void(0);" onclick="product_hot('<?php echo $pro->id;?>', 'no')"><img src="<?php echo img_link('active.png', 'admin'); ?>" class="icon png" title="Hủy sản phẩm nổi bật" alt="Hủy sản phẩm nổi bật"></a>
	            <?php endif; ?>
            </div>
            
            <div class="column" style="width: 10%;">
	            <?php if($pro->best_sales == 'no'): ?>
				<a href="javascript:void(0);" onclick="product_best_sales('<?php echo $pro->id;?>', 'yes')"><img src="<?php echo img_link('pending.png', 'admin'); ?>" class="icon png" title="Sản phẩm bán chạy" alt="Sản phẩm bán chạy"></a>
	            <?php else: ?>
				<a href="javascript:void(0);" onclick="product_best_sales('<?php echo $pro->id;?>', 'no')"><img src="<?php echo img_link('active.png', 'admin'); ?>" class="icon png" title="Hủy sản phẩm bán chạy" alt="Hủy sản phẩm bán chạy"></a>
	            <?php endif; ?>
            </div>
            
            <div class="column" style="width: 8%;">
	            <?php if($pro->status == 'no'): ?>
				<a href="javascript:void(0);" onclick="product_status('<?php echo $pro->id;?>', 'yes')"><img src="<?php echo img_link('pending.png', 'admin'); ?>" class="icon png" title="Kích hoạt" alt="Kích hoạt"></a>
	            <?php else: ?>
				<a href="javascript:void(0);" onclick="product_status('<?php echo $pro->id;?>', 'no')"><img src="<?php echo img_link('active.png', 'admin'); ?>" class="icon png" title="Hủy kích hoạt" alt="Hủy kích hoạt"></a>
	            <?php endif; ?>
            </div>
            
            </div>
        </div>
		<?php endforeach; ?>
		<?php endif; ?>

        <div class="bottom1">
        	<div class="column" style="width: 2%;"><input class="check_all" onclick="check_all(this)" value="" type="checkbox"></div>
            <div class="column" style="width: 50%;">
            	<select style="width: 130px;" id="action_name" name="action">
                    <option value="">Chọn hành động</option>
                    <option value="delete">Xóa</option>
                    <option value="active">Kích hoạt</option>
                    <option value="pending">Hủy kích hoạt</option>                    
                </select>
                <input value="Apply" class="btn" type="submit">
            </div>
            <span class="right1">
            	
                <div class="pagination">
                	
                    <ul>
                    <?php echo $pagnav; ?>
                    </ul>
                </div>
            </span>
        </div>
        
        </form>
        
    </div>

<script>
$('#action_form').iframer({
    onComplete: function(msg){
    	if(msg == 'yes') {
    		load_content('product_list', '<?php echo current_link(); ?>', true);
    	}
    	else show_error('div_message', msg)
    }
});
</script>